# import wtforms
# from wtforms import SubmitField
# from wtforms.validators import Length,Email,EqualTo,DataRequired
# from models import UserModel
# from flask_wtf import FlaskForm
#
# class RegisterForm(FlaskForm):
#     userid=wtforms.StringField(validators=[DataRequired(),Length(min=11,max=11,message="学号格式错误！")])
#     username=wtforms.StringField(validators=[DataRequired(),Length(min=1,max=20,message="用户名格式错误！")])
#     useremail=wtforms.StringField(validators=[DataRequired(),Email(message="邮箱错误！")])
#     userphone=wtforms.StringField(validators=[DataRequired(),Length(min=11,max=11,message="手机号格式错误！")])
#     userpassword=wtforms.PasswordField(validators=[DataRequired(),Length(min=6,max=20,message="密码格式错误！")])
#     password_confirm=wtforms.PasswordField(validators=[DataRequired(),EqualTo("userpassword",message="两次密码不一致！")])
#     submit1=SubmitField("注册")
#     # 自定义验证：学号是否存在
#     def validate_userid(self,field):
#         id=field.data
#         user=UserModel.query.filter_by(userid=id).first()
#         if user:
#             raise wtforms.ValidationError(message="学号已存在！")
#
# class LoginForm(FlaskForm):
#     userid = wtforms.StringField(validators=[DataRequired(), Length(min=11, max=11, message="学号格式错误！")])
#     userpassword = wtforms.PasswordField(validators=[DataRequired(), Length(min=6, max=20, message="密码格式错误！")])
#     submit2=SubmitField("登录")